/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
int n, m;
int a[maxn];
int rec[maxn];
int g[maxn];
int id(int i, int j)
{
    return (i)*m + j;
}
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            int tp;
            scanf("%d", &tp);
            a[id(i, j)] = tp;
        }
    }
    for (int i = 0; i < m; i++)
    {
        g[id(0, i)] = 1;
    }
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (a[id(i, j)] >= a[id(i - 1, j)])
            {
                g[id(i, j)] = g[id(i - 1, j)] + 1;
            }
            else
            {
                g[id(i, j)] = 1;
            }
        }
    }
    memset(rec, 0, sizeof(rec));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            rec[i] = max(rec[i], g[id(i, j)]);
        }
    }
    int q;
    scanf("%d", &q);
    while (q--)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        int len = r - l + 1;
        if (rec[r - 1] >= len)
            printf("Yes\n");
        else
            printf("No\n");
    }
    getchar();
    getchar();
    return 0;
}
